<!--  -->
<template>
    <div>
        <web-view
			v-if="bannerData.bannerType === '2'"
            :src="bannerData.urlLink"
        ></web-view>
       <div v-else-if="bannerData.bannerType === '4'">
            <u-swiper :list="bannerData.videoUrl" :autoplay="false"></u-swiper>
        </div>
        <div class="" v-else>
            <u-parse
                container-style="padding: 20px"
                :content="bannerData.graphicArticle"
                selectable
                use-anchor
            />
        </div>
    </div>
</template>

<script>
import { getConfigBannerInfo } from "@/api/shop.js";
export default {
    //import引入的组件需要注入到对象中才能使用
    components: {},
    data() {
        //这里存放数据
        return {
            bannerData: {
                bannerType: "",
                urlLink: "",
                graphicArticle: "",
                videoUrl: [],
            },
        };
    },
    mounted() {},
    onLoad(e) {
        const { id = "" } = e;
        getConfigBannerInfo(id).then((res) => {
            if (res.code === 200) {
                this.bannerData = res.data;
                if (res.data.videoUrl)
                    this.bannerData.videoUrl = [
                        JSON.parse(res?.data?.videoUrl)["url"],
                    ];
                console.log("res :>> ", this.bannerData);
                uni.setNavigationBarTitle({ title: this.bannerData.titleInfo });
            }
        });
    },
	methods:{
		onShareTimeline: function() {
			let that = this;
			return {
				title: that.bannerData.titleInfo,
				query: {
					id: that.bannerData.id,
				},
				imageUrl: that.bannerData.pictureUrl,
			};
		},
		onShareAppMessage: function() {
			// uni-app 会自动处理分享
			let that = this;
			// 返回数据
			return {
				title: that.bannerData.titleInfo,
				imageUrl: that.bannerData.pictureUrl,
				path: "pages_shop1/banner/index?id=" + that.bannerData.id,
			};
		},
	}
};
</script>
<style lang="scss" scoped>
//@import url(); 引入公共css类
</style>
